<template>
  <el-form ref="form" :inline="inline" :model="form" label-width="80px">
    <el-form-item v-for="item in formLabel" :key="item.model" :label="item.label">
      <el-input :model="form[item.model]" v-if="!item.type" :placeholder="'请输入' + item.label"></el-input>
      <el-select :model="form[item.model]" :placeholder="'请选择' + item.label" v-if="item.type === 'select'">
        <el-option v-for="opt in item.opts" :key="opt.value" :label="opt.label" :value="opt.value"></el-option>
      </el-select>
      <el-switch :model="form[item.model]" v-if="item.type === 'switch'"></el-switch>
      <el-date-picker :model="form[item.model]" type="date" placeholder="选择日期" v-if="item.type === 'date'"> </el-date-picker>
    </el-form-item>
    <el-form-item>
      <slot></slot>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  props: {
    form: Object,
    formLabel: Array,
    inline: Boolean,
  },
}
</script>

<style lang="scss" scoped></style>
